package com.ymatou.iapi.godmch.testcase;

import jdk.nashorn.internal.ir.annotations.Ignore;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.godmch.parameter.onRefreshBuyerSharePicBean;
import com.ymatou.iapi.godmch.parameter.submitRefreshBuyerSharePicTaskBean;
import com.ymatou.iapi.godmch.service.onRefreshBuyerSharePicCall;
import com.ymatou.iapi.godmch.service.submitRefreshBuyerSharePicTaskCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.model.godmch.buyer_invite_code;
import com.ymttest.database.model.godmch.buyer_invite_codeExample;
import com.ymttest.database.sqlwapper.godmch.buyer_invite_codeWapper;
/**
*提交刷新买家端店铺分享图任务
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_submitRefreshBuyerSharePicTask{
	private static submitRefreshBuyerSharePicTaskBean bean;
	private static submitRefreshBuyerSharePicTaskCall call;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("提交刷新买家端店铺分享图任务");
	}

	@Before
	public void caseUp() {
		bean=new submitRefreshBuyerSharePicTaskBean();
		call=new submitRefreshBuyerSharePicTaskCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_submitRefreshBuyerSharePicTask_001() {
		Logger.start(true,"提交刷新买家端店铺分享图任务-返回成功");
		try {
			//mchId500041475 对应的 客服userId501073646
			buyer_invite_codeExample example=new buyer_invite_codeExample();
			example.createCriteria().andUserIdEqualTo(501073646);
			buyer_invite_codeWapper codeMapper=new buyer_invite_codeWapper();
			buyer_invite_code code=codeMapper.selectByExample(example).get(0);	
			//修改InvitePicUrl=""
			code.setInvitePicUrl("");
			codeMapper.updateByPrimaryKey(code);
			
			bean.setMchId(500041475);
			call.setData(bean);
			call.callService();		
            //直接调MQ方法 onRefreshBuyerSharePic
			onRefreshBuyerSharePicBean onRefreshBuyerSharePicBean=new onRefreshBuyerSharePicBean();
			onRefreshBuyerSharePicCall onRefreshBuyerSharePicCall=new onRefreshBuyerSharePicCall();
			onRefreshBuyerSharePicBean.setUserId(501073646);
			onRefreshBuyerSharePicCall.setData(onRefreshBuyerSharePicBean);
			onRefreshBuyerSharePicCall.callService();	
			//查询
			Logger.verifyEquals("200", call.getString("status"), "验证status");
			code=codeMapper.selectByExample(example).get(0);	
			Logger.verifyEquals(true, code.getInvitePicUrl().length()>0, "验证InvitePicUrl为空");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}